1. /* scfcsin.cpp by K.Tsuru */
  2. // function ID = 9113
  3. /*****************************************
  4. SComplex class
  5. It returns sin(z).
  6. Let z = x+iy,
  7. sin(z) = sin(x)*cosh(y)+i*cos(x)sinh(y)
  8. = (i/2)*[exp(-iz)- exp(iz)]
  9. *****************************************/
  10. #ifndef SN_H
  11. #include "sn.h"
  12. #endif
  13. #define UseMultI 0
  14. SComplex Csin(const SComplex& z){
  15. #if 0 // 16.1 sec
  16. SDouble rr, ri, sh;
  17. sh = Sinh(z.Imag());
  18. rr = Sin(z.Real())*Sqrt(1.0+sh*sh);
  19. ri = Cos(z.Real())*sh;
  20. return SComplex(rr, ri);
  21. #elif UseMultI // 15.9 sec
  22. SComplex eiz = Cexp(MultI(z)), r;
  23. r = 1.0/eiz - eiz;
  24. r.MultI();
  25. return r.CsDiv(2L); // faster than r/2
  26. #else // 15.8 sec
  27. SComplex eiz = Cexp(IU*z), r;
  28. r = 1.0/eiz - eiz;
  29. r *= IU; // faster than r = r*I
  30. return r.CsDiv(2L); // faster than r/2
  31. #endif
  32. }

scfcsin.cpp : last modifiled at 2015/10/23 15:49:01(819 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).